package sudroid;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;

public class ZipMe
{
  private static final int BTYPE_DYNAMIC = 2;
  private static final int BTYPE_NONE = 0;
  private static final int[] DISTANCE_EXTRA_BITS;
  private static final int[] DISTANCE_VALUES;
  private static final int[] DYNAMIC_LENGTH_ORDER;
  private static final int EOB_CODE = 256;
  private static final int[] LENGTH_EXTRA_BITS;
  private static final int[] LENGTH_VALUES;
  private static final int MAX_BITS = 16;
  private static final int MAX_CODE_DISTANCES = 31;
  private static final int MAX_CODE_LENGTHS = 18;
  private static final int MAX_CODE_LITERALS = 287;
  private int curBit;
  private int curByte;
  private int curIndex;
  private byte[] data;
  private Hashtable htToc;

  static
  {
    int[] arrayOfInt1 = new int[31];
    arrayOfInt1[8] = 1;
    arrayOfInt1[9] = 1;
    arrayOfInt1[10] = 1;
    arrayOfInt1[11] = 1;
    arrayOfInt1[12] = 2;
    arrayOfInt1[13] = 2;
    arrayOfInt1[14] = 2;
    arrayOfInt1[15] = 2;
    arrayOfInt1[16] = 3;
    arrayOfInt1[17] = 3;
    arrayOfInt1[18] = 3;
    arrayOfInt1[19] = 3;
    arrayOfInt1[20] = 4;
    arrayOfInt1[21] = 4;
    arrayOfInt1[22] = 4;
    arrayOfInt1[23] = 4;
    arrayOfInt1[24] = 5;
    arrayOfInt1[25] = 5;
    arrayOfInt1[26] = 5;
    arrayOfInt1[27] = 5;
    arrayOfInt1[29] = 99;
    arrayOfInt1[30] = 99;
    LENGTH_EXTRA_BITS = arrayOfInt1;
    int[] arrayOfInt2 = new int[31];
    arrayOfInt2[0] = 3;
    arrayOfInt2[1] = 4;
    arrayOfInt2[2] = 5;
    arrayOfInt2[3] = 6;
    arrayOfInt2[4] = 7;
    arrayOfInt2[5] = 8;
    arrayOfInt2[6] = 9;
    arrayOfInt2[7] = 10;
    arrayOfInt2[8] = 11;
    arrayOfInt2[9] = 13;
    arrayOfInt2[10] = 15;
    arrayOfInt2[11] = 17;
    arrayOfInt2[12] = 19;
    arrayOfInt2[13] = 23;
    arrayOfInt2[14] = 27;
    arrayOfInt2[15] = 31;
    arrayOfInt2[16] = 35;
    arrayOfInt2[17] = 43;
    arrayOfInt2[18] = 51;
    arrayOfInt2[19] = 59;
    arrayOfInt2[20] = 67;
    arrayOfInt2[21] = 83;
    arrayOfInt2[22] = 99;
    arrayOfInt2[23] = 115;
    arrayOfInt2[24] = 131;
    arrayOfInt2[25] = 163;
    arrayOfInt2[26] = 195;
    arrayOfInt2[27] = 227;
    arrayOfInt2[28] = 258;
    LENGTH_VALUES = arrayOfInt2;
    int[] arrayOfInt3 = new int[30];
    arrayOfInt3[4] = 1;
    arrayOfInt3[5] = 1;
    arrayOfInt3[6] = 2;
    arrayOfInt3[7] = 2;
    arrayOfInt3[8] = 3;
    arrayOfInt3[9] = 3;
    arrayOfInt3[10] = 4;
    arrayOfInt3[11] = 4;
    arrayOfInt3[12] = 5;
    arrayOfInt3[13] = 5;
    arrayOfInt3[14] = 6;
    arrayOfInt3[15] = 6;
    arrayOfInt3[16] = 7;
    arrayOfInt3[17] = 7;
    arrayOfInt3[18] = 8;
    arrayOfInt3[19] = 8;
    arrayOfInt3[20] = 9;
    arrayOfInt3[21] = 9;
    arrayOfInt3[22] = 10;
    arrayOfInt3[23] = 10;
    arrayOfInt3[24] = 11;
    arrayOfInt3[25] = 11;
    arrayOfInt3[26] = 12;
    arrayOfInt3[27] = 12;
    arrayOfInt3[28] = 13;
    arrayOfInt3[29] = 13;
    DISTANCE_EXTRA_BITS = arrayOfInt3;
    DISTANCE_VALUES = new int[] { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 };
    int[] arrayOfInt4 = new int[19];
    arrayOfInt4[0] = 16;
    arrayOfInt4[1] = 17;
    arrayOfInt4[2] = 18;
    arrayOfInt4[4] = 8;
    arrayOfInt4[5] = 7;
    arrayOfInt4[6] = 9;
    arrayOfInt4[7] = 6;
    arrayOfInt4[8] = 10;
    arrayOfInt4[9] = 5;
    arrayOfInt4[10] = 11;
    arrayOfInt4[11] = 4;
    arrayOfInt4[12] = 12;
    arrayOfInt4[13] = 3;
    arrayOfInt4[14] = 13;
    arrayOfInt4[15] = 2;
    arrayOfInt4[16] = 14;
    arrayOfInt4[17] = 1;
    arrayOfInt4[18] = 15;
    DYNAMIC_LENGTH_ORDER = arrayOfInt4;
  }

  public ZipMe(InputStream paramInputStream)
    throws IOException
  {
    byte[] arrayOfByte = inputStreamToBytes(paramInputStream);
    ZipMe localZipMe = reset(arrayOfByte);
  }

  public ZipMe(byte[] paramArrayOfByte)
  {
    ZipMe localZipMe = reset(paramArrayOfByte);
  }

  private final byte[] codeLengths(byte[] paramArrayOfByte, int[] paramArrayOfInt, int paramInt)
  {
    byte[] arrayOfByte = new byte[paramInt];
    int i = 0;
    int j = 0;
    if (j >= paramInt)
      return arrayOfByte;
    int k = readCode(paramArrayOfByte, paramArrayOfInt);
    int n;
    label60: int i1;
    int i2;
    if (k >= 16)
      if (k == 16)
      {
        int m = readBits(paramArrayOfByte, 2) + 3;
        k = i;
        n = m;
        i1 = n + -1;
        if (n > 0)
          break label129;
        i2 = j;
      }
    while (true)
    {
      i = k;
      j = i2;
      break;
      if (k == 17);
      for (i1 = readBits(paramArrayOfByte, 3) + 3; ; i1 = readBits(paramArrayOfByte, 7) + 11)
      {
        k = 0;
        n = i1;
        break;
      }
      label129: int i3 = j + 1;
      int i4 = (byte)k;
      arrayOfByte[j] = i4;
      n = i1;
      j = i3;
      break label60;
      i2 = j + 1;
      int i5 = (byte)k;
      arrayOfByte[j] = i5;
    }
  }

  private static final int[] huffmanTree(byte[] paramArrayOfByte, int paramInt)
  {
    int[] arrayOfInt1 = new int[17];
    int j = 0;
    int k = paramArrayOfByte.length;
    int[] arrayOfInt2;
    if (j >= k)
    {
      j = 0;
      arrayOfInt1[0] = 0;
      arrayOfInt2 = new int[17];
      k = 1;
    }
    int[] arrayOfInt3;
    int m;
    while (true)
    {
      if (k > 16)
      {
        arrayOfInt3 = new int[(paramInt << 1) + 16];
        m = 1;
        k = 0;
        int n = j;
        if (k <= paramInt)
          break label127;
        return arrayOfInt3;
        int i1 = paramArrayOfByte[j];
        int i2 = arrayOfInt1[i1] + 1;
        arrayOfInt1[i1] = i2;
        j += 1;
        break;
      }
      int i3 = k - 1;
      int i4 = arrayOfInt1[i3];
      j = j + i4 << 1;
      arrayOfInt2[k] = j;
      k += 1;
    }
    label127: int i5 = paramArrayOfByte[k];
    int i7;
    int i;
    if (i5 != 0)
    {
      j = arrayOfInt2[i5];
      int i6 = j + 1;
      arrayOfInt2[i5] = i6;
      i7 = 0;
      i = i5 - 1;
      if (i < 0)
      {
        int i8 = 0x80000000 | k;
        arrayOfInt3[i7] = i8;
        i5 = m;
        int i9 = j;
      }
    }
    while (true)
    {
      k += 1;
      m = i5;
      break;
      if ((1 << i & j) == 0)
      {
        i5 = arrayOfInt3[i7] >> 16;
        if (i5 == 0)
        {
          int i10 = arrayOfInt3[i7];
          int i11 = m << 16;
          int i12 = i10 | i11;
          arrayOfInt3[i7] = i12;
          i7 = m + 1;
          i5 = m;
        }
      }
      while (true)
      {
        i += -1;
        m = i7;
        i7 = i5;
        break;
        i5 = i5;
        i7 = m;
        continue;
        i5 = arrayOfInt3[i7] & 0xFFFF;
        if (i5 == 0)
        {
          int i13 = arrayOfInt3[i7] | m;
          arrayOfInt3[i7] = i13;
          i7 = m + 1;
          i5 = m;
          continue;
        }
        i5 = i5;
        i7 = m;
      }
      i5 = m;
    }
  }

  private static final byte[] inputStreamToBytes(InputStream paramInputStream)
    throws IOException
  {
    ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
    byte[] arrayOfByte = new byte[10000];
    for (int i = paramInputStream.read(arrayOfByte); ; i = paramInputStream.read(arrayOfByte))
    {
      if (i <= 0)
        return localByteArrayOutputStream.toByteArray();
      localByteArrayOutputStream.write(arrayOfByte, 0, i);
    }
  }

  private static final int read(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
  {
    int i = 0;
    int j = paramInt1;
    int k = 0;
    int m = paramInt1 + paramInt2;
    while (true)
    {
      if (j >= m)
        return i;
      int n = (paramArrayOfByte[j] & 0xFF) << k;
      i |= n;
      j += 1;
      k += 8;
    }
  }

  private final int readBits(byte[] paramArrayOfByte, int paramInt)
  {
    int m;
    int i1;
    if (this.curBit == 0)
    {
      int i = this.curIndex;
      int j = i + 1;
      this.curIndex = j;
      int k = paramArrayOfByte[i] & 0xFF;
      this.curByte = k;
      m = k;
      int n = this.curBit;
      i1 = 8 - n;
    }
    while (true)
    {
      if (i1 >= paramInt)
      {
        int i2 = this.curBit + paramInt & 0x7;
        this.curBit = i2;
        return (1 << paramInt) - 1 & m;
        int i3 = this.curByte;
        int i4 = this.curBit;
        m = i3 >> i4;
        break;
      }
      int i5 = this.curIndex;
      int i6 = i5 + 1;
      this.curIndex = i6;
      int i7 = paramArrayOfByte[i5] & 0xFF;
      this.curByte = i7;
      int i8 = this.curByte << i1;
      m |= i8;
      i1 += 8;
    }
  }

  private final int readCode(byte[] paramArrayOfByte, int[] paramArrayOfInt)
  {
    int i = paramArrayOfInt[0];
    if (i < 0)
      return i & 0xFFFF;
    if (this.curBit == 0)
    {
      int j = this.curIndex;
      int k = j + 1;
      this.curIndex = k;
      int m = paramArrayOfByte[j] & 0xFF;
      this.curByte = m;
    }
    int n = this.curByte;
    int i1 = this.curBit;
    int i2 = 1 << i1;
    int i3;
    if ((n & i2) == 0)
      i3 = i >> 16;
    int i5;
    for (i = paramArrayOfInt[i3]; ; i = paramArrayOfInt[i5])
    {
      int i4 = this.curBit + 1 & 0x7;
      this.curBit = i4;
      break;
      i5 = i & 0xFFFF;
    }
  }

  public final byte[] get(String paramString)
  {
    if (this.htToc == null)
      Vector localVector = list();
    int[] arrayOfInt = (int[])this.htToc.get(paramString);
    Object localObject;
    if (arrayOfInt == null)
      localObject = null;
    while (true)
    {
      return localObject;
      if (arrayOfInt[1] == 0)
      {
        localObject = new byte[0];
        continue;
      }
      if (arrayOfInt[3] == 0)
      {
        byte[] arrayOfByte1 = new byte[arrayOfInt[2]];
        byte[] arrayOfByte2 = this.data;
        int i = arrayOfInt[0];
        int j = arrayOfInt[2];
        System.arraycopy(arrayOfByte2, i, arrayOfByte1, 0, j);
        localObject = arrayOfByte1;
        continue;
      }
      if (arrayOfInt[3] == 8)
      {
        byte[] arrayOfByte3 = this.data;
        int k = arrayOfInt[0];
        int m = arrayOfInt[2];
        localObject = inflate(arrayOfByte3, k, m);
        continue;
      }
      localObject = null;
    }
  }

  public final byte[] inflate(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
  {
    int i = paramInt1;
    this.curIndex = i;
    byte[] arrayOfByte1 = new byte[paramInt2];
    int j = 0;
    this.curBit = j;
    int k = 0;
    this.curByte = k;
    int m = 0;
    int n = 0;
    int i4;
    while (true)
    {
      ZipMe localZipMe1 = this;
      byte[] arrayOfByte2 = paramArrayOfByte;
      int i1 = 1;
      int i2 = localZipMe1.readBits(arrayOfByte2, i1);
      ZipMe localZipMe2 = this;
      byte[] arrayOfByte3 = paramArrayOfByte;
      int i3 = 2;
      i4 = localZipMe2.readBits(arrayOfByte3, i3);
      if (i4 != 0)
        break;
      int i5 = 0;
      this.curBit = i5;
      ZipMe localZipMe3 = this;
      byte[] arrayOfByte4 = paramArrayOfByte;
      int i6 = 16;
      int i7 = localZipMe3.readBits(arrayOfByte4, i6);
      ZipMe localZipMe4 = this;
      byte[] arrayOfByte5 = paramArrayOfByte;
      int i8 = 16;
      int i9 = localZipMe4.readBits(arrayOfByte5, i8);
      int i10 = this.curIndex;
      byte[] arrayOfByte6 = paramArrayOfByte;
      int i11 = i10;
      byte[] arrayOfByte7 = arrayOfByte1;
      int i12 = n;
      int i13 = i7;
      System.arraycopy(arrayOfByte6, i11, arrayOfByte7, i12, i13);
      int i14 = this.curIndex + i7;
      this.curIndex = i14;
      int i15 = n + i7;
      if (i2 != 0)
        return arrayOfByte1;
    }
    int i16 = i4;
    int i17 = 2;
    byte[] arrayOfByte11;
    int i24;
    int[] arrayOfInt3;
    int[] arrayOfInt5;
    if (i16 == i17)
    {
      ZipMe localZipMe5 = this;
      byte[] arrayOfByte8 = paramArrayOfByte;
      int i18 = 5;
      int i19 = localZipMe5.readBits(arrayOfByte8, i18) + 257;
      ZipMe localZipMe6 = this;
      byte[] arrayOfByte9 = paramArrayOfByte;
      int i20 = 5;
      int i21 = localZipMe6.readBits(arrayOfByte9, i20) + 1;
      ZipMe localZipMe7 = this;
      byte[] arrayOfByte10 = paramArrayOfByte;
      int i22 = 4;
      int i23 = localZipMe7.readBits(arrayOfByte10, i22) + 4;
      arrayOfByte11 = new byte[19];
      i24 = 0;
      if (i24 >= i23)
      {
        byte[] arrayOfByte12 = arrayOfByte11;
        int i25 = 18;
        int[] arrayOfInt1 = huffmanTree(arrayOfByte12, i25);
        ZipMe localZipMe8 = this;
        byte[] arrayOfByte13 = paramArrayOfByte;
        int[] arrayOfInt2 = arrayOfInt1;
        int i26 = i19;
        byte[] arrayOfByte14 = localZipMe8.codeLengths(arrayOfByte13, arrayOfInt2, i26);
        int i27 = i19 - 1;
        arrayOfInt3 = huffmanTree(arrayOfByte14, i27);
        ZipMe localZipMe9 = this;
        byte[] arrayOfByte15 = paramArrayOfByte;
        int[] arrayOfInt4 = arrayOfInt1;
        int i28 = i21;
        byte[] arrayOfByte16 = localZipMe9.codeLengths(arrayOfByte15, arrayOfInt4, i28);
        int i29 = i21 - 1;
        arrayOfInt5 = huffmanTree(arrayOfByte16, i29);
      }
    }
    while (true)
    {
      label401: ZipMe localZipMe10 = this;
      byte[] arrayOfByte17 = paramArrayOfByte;
      int[] arrayOfInt6 = arrayOfInt3;
      int i30 = localZipMe10.readCode(arrayOfByte17, arrayOfInt6);
      int i31 = i30;
      int i32 = 256;
      if (i31 == i32)
        break;
      int i33 = i30;
      int i34 = 256;
      if (i33 > i34)
      {
        int i35 = i30 + -257;
        int i36 = LENGTH_VALUES[i35];
        int i37 = LENGTH_EXTRA_BITS[i35];
        if (i37 > 0)
        {
          ZipMe localZipMe11 = this;
          byte[] arrayOfByte18 = paramArrayOfByte;
          int i38 = i37;
          int i39 = localZipMe11.readBits(arrayOfByte18, i38);
          i36 += i39;
        }
        ZipMe localZipMe12 = this;
        byte[] arrayOfByte19 = paramArrayOfByte;
        int[] arrayOfInt7 = arrayOfInt5;
        int i40 = localZipMe12.readCode(arrayOfByte19, arrayOfInt7);
        int i41 = DISTANCE_VALUES[i40];
        int i42 = DISTANCE_EXTRA_BITS[i40];
        if (i42 > 0)
        {
          ZipMe localZipMe13 = this;
          byte[] arrayOfByte20 = paramArrayOfByte;
          int i43 = i42;
          int i44 = localZipMe13.readBits(arrayOfByte20, i43);
          i41 += i44;
        }
        int i45 = n - i41;
        while (true)
        {
          int i46 = i41;
          int i47 = i36;
          if (i46 >= i47)
          {
            byte[] arrayOfByte21 = arrayOfByte1;
            int i48 = i45;
            byte[] arrayOfByte22 = arrayOfByte1;
            int i49 = n;
            int i50 = i36;
            System.arraycopy(arrayOfByte21, i48, arrayOfByte22, i49, i50);
            n += i36;
            break label401;
            int i51 = DYNAMIC_LENGTH_ORDER[i24];
            ZipMe localZipMe14 = this;
            byte[] arrayOfByte23 = paramArrayOfByte;
            int i52 = 3;
            int i53 = (byte)localZipMe14.readBits(arrayOfByte23, i52);
            arrayOfByte11[i51] = i53;
            i24 += 1;
            break;
            byte[] arrayOfByte24 = new byte[288];
            i24 = 144;
            label703: i24 += -1;
            label720: label748: byte[] arrayOfByte26;
            if (i24 < 0)
            {
              i24 = 256;
              i24 += -1;
              int i54 = i24;
              int i55 = 144;
              if (i54 >= i55)
                break label870;
              i24 = 280;
              i24 += -1;
              int i56 = i24;
              int i57 = 256;
              if (i56 >= i57)
                break label880;
              i24 = 288;
              label776: i24 += -1;
              int i58 = i24;
              int i59 = 280;
              if (i58 >= i59)
                break label890;
              byte[] arrayOfByte25 = arrayOfByte24;
              int i60 = 287;
              arrayOfInt3 = huffmanTree(arrayOfByte25, i60);
              arrayOfByte26 = new byte[32];
              i24 = arrayOfByte26.length;
            }
            while (true)
            {
              i24 += -1;
              if (i24 < 0)
              {
                byte[] arrayOfByte27 = arrayOfByte26;
                int i61 = 31;
                arrayOfInt5 = huffmanTree(arrayOfByte27, i61);
                break;
                arrayOfByte24[i24] = 8;
                break label703;
                label870: arrayOfByte24[i24] = 9;
                break label720;
                label880: arrayOfByte24[i24] = 7;
                break label748;
                label890: arrayOfByte24[i24] = 8;
                break label776;
              }
              arrayOfByte26[i24] = 5;
            }
          }
          byte[] arrayOfByte28 = arrayOfByte1;
          int i62 = i45;
          byte[] arrayOfByte29 = arrayOfByte1;
          int i63 = n;
          int i64 = i41;
          System.arraycopy(arrayOfByte28, i62, arrayOfByte29, i63, i64);
          n += i41;
          i36 -= i41;
          i41 <<= 1;
        }
      }
      int i65 = n + 1;
      int i66 = (byte)i30;
      arrayOfByte1[n] = i66;
      n = i65;
    }
  }

  public final Vector list()
  {
    Hashtable localHashtable = this.htToc;
    int i;
    int j;
    Vector localVector;
    Enumeration localEnumeration;
    if (localHashtable == null)
    {
      localHashtable = new Hashtable();
      this.htToc = localHashtable;
      i = 0;
      j = i;
      if (read(this.data, j, 4) == 67324752);
    }
    else
    {
      int k = localHashtable.size();
      localVector = new Vector(k);
      localEnumeration = localHashtable.keys();
    }
    while (true)
    {
      if (!localEnumeration.hasMoreElements())
      {
        return localVector;
        int m = j + 8;
        int n = read(this.data, m, 2);
        int i1 = m + 10;
        int i2 = read(this.data, i1, 4);
        int i3 = i1 + 4;
        int i4 = read(this.data, i3, 4);
        int i5 = i3 + 4;
        int i6 = read(this.data, i5, 2);
        int i7 = i5 + 2;
        int i8 = read(this.data, i7, 2);
        int i9 = i7 + 2;
        byte[] arrayOfByte = this.data;
        String str1 = new String(arrayOfByte, i9, i6);
        int i10 = i6 + i8;
        int i11 = i9 + i10;
        int[] arrayOfInt = new int[5];
        arrayOfInt[0] = i11;
        arrayOfInt[1] = i2;
        arrayOfInt[2] = i4;
        arrayOfInt[3] = n;
        int i12 = i + 1;
        arrayOfInt[4] = i;
        Object localObject = localHashtable.put(str1, arrayOfInt);
        j = i11 + i2;
        i = i12;
        break;
      }
      String str2 = (String)localEnumeration.nextElement();
      boolean bool = localVector.add(str2);
    }
  }

  public final ZipMe reset(byte[] paramArrayOfByte)
  {
    this.data = paramArrayOfByte;
    this.htToc = null;
    return this;
  }
}

/* Location:           D:\Program Files\eclipse\apktool-r01-3\新浪微博\classes.dex.dex2jar.jar
 * Qualified Name:     sudroid.ZipMe
 * JD-Core Version:    0.6.0
 */